Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle write-only properties #1377

Merged
merged 4 commits into from
Feb 28, 2024
Merged

Handle write-only properties #1377

merged 4 commits into from
Feb 28, 2024

Conversation

danielrbradley
Copy link
Member

@danielrbradley danielrbradley commented Feb 28, 2024

Fixes #1373

  • After create and update, merge the create-only inputs as outputs for completeness and to avoid SDKs filling in the non-checked inputs.
  • Don't create-only output props if they happen to be returned - prefer the values from the service where possible even if we weren't expecting them.
  • Warn about missing properties on import and refresh.

This also allows us to re-enable testing of refreshes.

- After create and update, merge the create-only inputs as outputs for completeness and to avoid SDKs filling in the non-checked inputs.
- Don't create-only output props if they happen to be returned - prefer the values from the service where possible even if we weren't expecting them.
- Warn about missing properties on import and refresh.
@danielrbradley danielrbradley self-assigned this Feb 28, 2024
@danielrbradley danielrbradley added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Feb 28, 2024
Copy link
Contributor

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 7.31707% with 38 lines in your changes are missing coverage. Please review.

Project coverage is 22.71%. Comparing base (8a585ea) to head (ad7188d).
Report is 1 commits behind head on master.

Files Patch % Lines
provider/pkg/provider/provider.go 7.31% 36 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1377      +/-   ##
==========================================
- Coverage   22.82%   22.71%   -0.11%     
==========================================
  Files          25       25              
  Lines        4197     4226      +29     
==========================================
+ Hits          958      960       +2     
- Misses       3079     3105      +26     
- Partials      160      161       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@danielrbradley danielrbradley removed the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Feb 28, 2024
Copy link
Contributor

@thomas11 thomas11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM apart from the Go test setup question

baseGo := base.With(integration.ProgramTestOptions{
Verbose: true,
Dependencies: []string{
"github.com/pulumi/pulumi-aws-native/sdk",
fmt.Sprintf("github.com/pulumi/pulumi-aws-native/sdk=%s", sdkPath),
Copy link
Contributor

@thomas11 thomas11 Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this shouldn't be necessary, and I'm surprised it even works. ProgramTest already creates the mod replace entries for each of the Dependencies here.

In pulumi-aws, e.g., we just pass the name of the dependency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That code only works if the PULUMI_DEP_ROOT env is set, so fails for running tests in the IDE. This is a much more reliable approach.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. It would be more concise then to have a ProgramTest option equivalent to PULUMI_DEP_ROOT, and just pass in the plain dependencies to be replaced.

@danielrbradley danielrbradley merged commit a8d815c into master Feb 28, 2024
17 checks passed
@danielrbradley danielrbradley deleted the 1373-write-only-props branch February 28, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write-only properties not available as outputs
2 participants